<!DOCTYPE html>
<html lang="en">
<include file="Public/header" title="新建物品记录" keywords="社团管理系统，常州大学，课程设计" />
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="form-horizontal">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">收支类型</label>
                            <div class="col-sm-10">
                                <div class="radio i-checks">
                                    <label>
                                        <input type="radio" value="1" name="expensemethod"> <i></i>收入</label>
                                </div>
                                <div class="radio i-checks">
                                    <label>
                                        <input type="radio" value="2" name="expensemethod"> <i></i>支出</label>
                                </div>
                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">金额</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="expensecharge">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">时间</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="expensetime">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">笔记</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="expensenote">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <button type="button" class="btn btn-w-m btn-info" id="subbtn">提交申请</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<include file="Public/footer"/>
<script>
    $(function () {
        $('#subbtn').on('click',function () {
            var expensemethod = $("input[type='radio']").val();
            var expensecharge = $('#expensecharge').val();
            var expensenote = $('#expensenote').val();
            var expensetime = $('#expensetime').val();
            var param = {
                expensemethod:expensemethod,
                expensecharge:expensecharge,
                expensenote:expensenote,
                expensetime:expensetime
            };
            console.log(param);
            if(!expensemethod || !expensecharge || !expensenote){
                alert('每一项都必须填写');
            }else{
                var url ="{:U('Expense/newexpense')}";
                $.ajax({
                    url:url,
                    data:param,
                    dataType:'json',
                    type:'post',
                    success:function (data) {
                        alert(data.info);
                    },
                    error:function () {
                        alert('操作失败');
                    }
                })
            }
        })
    })
</script>
</html>
